﻿using System;

namespace Candy.Infrastructure
{
    public static class ConfirmationHandler
    {
        public static void ConfirmAction(Action<bool> callback, string message)
        {
            if (_control == null)
                throw new InvalidOperationException("ConfirmationHandler is not initialized yet.");

            _control.ConfirmAction(callback, message);
        }

        private static IConfirmationControl _control;
        public static void Initialize(IConfirmationControl control)
        {
            if (control != null)
                _control = control;
            else
                throw new ArgumentNullException("ConfirmationControl can't be null.");
        }
    }
}
